package br.com.carrosvale.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import br.com.carrosvale.model.entity.Login;
import br.com.carrosvale.model.service.UsuarioService;


@Controller
@Transactional(rollbackFor=Exception.class)
@RequestMapping(value="/usuario")
public class UsuarioController {

	private UsuarioService usuarioService; 

	@RequestMapping(method=RequestMethod.POST)
	public String cadastrar( Login login ){
		return "usuario/cadastro";
	}
		
	@RequestMapping(method=RequestMethod.GET)
	public String index( Model model ){
		model.addAttribute("login", new Login());
		return "usuario/cadastro";
	}

	@Autowired
	public void setUsuarioService(UsuarioService usuarioService) {
		this.usuarioService = usuarioService;
	}

}
